// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()

// 云函数入口函数
exports.main = async (event, context) => {
  const db = cloud.database()
  console.log(event)
  if(event.level==3){
    return await db.collection('scanCode').where({
      brandidThree:event.brandid,
      device_logicid:event.device_logicid,
    }).get()
  }else if(event.level==4){
    return await db.collection('scanCode').where({
      brandidFour:event.brandid,
      device_logicid:event.device_logicid,
    }).get()
  }else if(event.level==5){
    return await db.collection('scanCode').where({
      brandidFive:event.brandid,
      device_logicid:event.device_logicid,
    }).get()
  }
}